Merged
Conversation
Implement full e-commerce item management service following
OpenTaberna mini-API architecture pattern.
- 6 RESTful CRUD endpoints with proper HTTP semantics
- Repository pattern with specialized queries
- UUID primary keys with automatic timestamps
- PostgreSQL JSONB for flexible nested data
- Comprehensive validation and error handling
- \`POST /api/v1/items/\` - Create item (201)
- \`GET /api/v1/items/{uuid}\` - Get by UUID (200/404)
- \`GET /api/v1/items/\` - List with pagination (200)
- \`GET /api/v1/items/by-slug/{slug}\` - Get by slug (200/404)
- \`PATCH /api/v1/items/{uuid}\` - Update item (200/404/400)
- \`DELETE /api/v1/items/{uuid}\` - Delete item (204/404)
- 9 enums (ItemStatus, StockStatus, TaxClass, etc.)
- 8 nested models (PriceModel, MediaModel, InventoryModel, etc.)
- Pydantic v2 with ConfigDict for validation
- SQLAlchemy async ORM with indexed columns
- Duplicate SKU/slug validation with 400 responses
- Pagination with configurable skip/limit
- Status-based filtering
- JSONB storage for attributes, identifiers, custom data
- Async/await for non-blocking I/O
- Proper dependency injection with get_session_dependency
BREAKING CHANGE: Renames service directory from crud-item-store
to crud_item_store (Python naming convention)
All tests passing
PhilippTheServer
requested changes
Mar 2, 2026
Contributor
PhilippTheServer
left a comment
There was a problem hiding this comment.
Thanks for your PR. I left some review comments you might want to look at.
src/app/main.py
Outdated
| from app.shared.database.engine import close_database, get_engine, init_database | ||
|
|
||
|
|
||
| @asynccontextmanager |
Contributor
There was a problem hiding this comment.
This belongs in its own routers file in the chore dir and not in main.py
…mples and test sections
Contributor
PhilippTheServer
left a comment
There was a problem hiding this comment.
I like the restructuring. When you mode the buisness logic out of the routers file feel free to merge the PR. Thanks for your contribution
…hods. Use BaseRepository.get_by() method
PhilippTheServer
approved these changes
Mar 4, 2026
Contributor
PhilippTheServer
left a comment
There was a problem hiding this comment.
looks good to me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
Description
Complete CRUD service for managing store items, following the mini-API architecture pattern. Includes 6 REST endpoints covering the full item lifecycle with support for pagination, slug-based lookup, and flexible data storage.
The data model uses PostgreSQL JSONB for nested structures (pricing, inventory, shipping, media), allowing custom fields without schema migrations while maintaining indexed columns for fast queries on core fields.
Motivation
Reference implementation of the mini-API pattern with sufficient complexity to showcase repository layer, validation, and error handling. Provides foundation for e-commerce item management with extensibility for future plugins.
API Changes
New Endpoints:
POST /api/v1/items/- Create itemGET /api/v1/items/{uuid}- Get by UUIDGET /api/v1/items/- List with pagination and filteringGET /api/v1/items/by-slug/{slug}- Get by URL slugPATCH /api/v1/items/{uuid}- Partial updateDELETE /api/v1/items/{uuid}- Delete itemDatabase Changes
New
itemstable with indexed core fields (sku, slug, name, brand, status) and JSONB columns for nested data (price, inventory, shipping, attributes, identifiers). Tables auto-create on startup in development mode.Documentation
docs/)Testing
Related Issues
Closes #
Checklist
env.exampleif needed